package com.zhangck.bos2_0.action.take_delivery;

import java.util.HashMap;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionContext;
import com.zhangck.bos2_0.Service.take_delivery.WayBillServices;
import com.zhangck.bos2_0.Service.take_delivery.WayBillquickServices;
import com.zhangck.bos2_0.common.BaseAction;

import cn.itcast.bos.domain.take_delivery.Order;

/** 
* @author 上午茶
* @version 创建时间：2018年6月13日 上午10:35:06 
* 类说明 
*/
@ParentPackage("json-default")
@Namespace("/")
@Controller
@Scope("prototype")
public class WayBillAction extends BaseAction<Order> {

	@Autowired
	private WayBillServices wayBillServices;
	
	@Action(value="orderNum_find",results={@Result(name="success" , type="json")})
	public String orderNum_find(){
		 Order order =  wayBillServices.findByOrderNum(model.getOrderNum());
		 Map<String, Object> map = new HashMap<>();
		 try {
			 map.put("success", true);
			 map.put("orderData", order);
		} catch (Exception e) {
			map.put("success", false);
			 map.put("orderData", order);
		}
		 ActionContext.getContext().getValueStack().push(map);
		return "success";
	}
	
}
